def mavenCall(Map config){
    def dingmes = new org.devops.dingmes()
    def gitclone = new org.devops.git()
    // def build = new org.devops.build()
    pipeline {
        parameters {
            environment { //设置环境变量 与Jenkinsfile对应
                git_credentials_id = "${config.CREID}"
                git_url = "${config.GITURL}"
                default_branch = "${config.DEFAULT_BRANCH}"

                mvn_param = "${config.MVN_PARAM}"

                
            }
            gitParameter (
                            defaultValue: 'master',
                            branchFilter: 'origin/(.*)',
                            name: 'BRANCH',
                            quickFilterEnabled: true,
                            selectedValue: 'DEFAULT',
                            sortMode: 'DESCENDING_SMART',
                            tagFilter: '*',
                            type: 'PT_BRANCH',
                            description: 'Please select a branch or tag to build',
                            useRepository: git_url
                        )
        } 
        agent any

        stages {
            stage('Git Clone') {
                steps {
                    sh """
                    echo ${params.BRANCH_TAG}
                    echo ${BRANCH_TAG}
                    """
                }
            }        
            stage('Git Clone') {
                steps {
                    script {
                        BRANCH_TAG = sh(returnStdout: true,script: "echo ${params.BRANCH_TAG}|awk -F '/' '{print \$NF}'").trim()
                        
                        gitclone.gitco(params.BRANCH_TAG,git_credentials_id,git_url)
                    }
                }
            }
            // stage('maven build') {
            //     steps {
            //         container('maven'){
            //             script {
            //                 build.mavenbuild(mavenEnvParameter)
            //             }
            //         }
            //     }
            // }
        }
        post {
            success {
                script {
                    dingmes.DingdingReq(robotId, "构建成功 ✅")
                }
            }
            failure {
                script {
                    dingmes.DingdingReq(robotId, "构建失败 ❌")
                }
            }
        }
    } 
}